<template>
	<view>
		<view class="list-group">
			<view v-for="(item,index) in list" :key="index" class="list-item" @click="handleClick(item)">
				<view class="list-item-title">{{item.title}}</view>
				<u-icon size="15" name="arrow-right"></u-icon>
			</view>
		</view>
		<br />
		<view style="display: none;">
			<u-modal :show="show" @confirm="confirm">
				<u-input v-model="empid"></u-input>
			</u-modal>
			<u-button @click="show = true">修改empid</u-button>
			<br />
			<u-button @click="handleClear">清除缓存</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
						title: "我的待办",
						path: "/pages/todo-list/index/index"
					},
					{
						title: "办理记录",
						path: "/pages/todo-list/processing-records/index"
					},
					{
						title: "退回记录",
						path: "/pages/todo-list/return-record/index"
					},
				],
				show: false,
				title: '修改empid',
				empid: ''
			}
		},
		onShow() {
			this.empid = uni.getStorageSync("empid")
		},
		methods: {
			handleClick(item) {
				uni.navigateTo({
					url: item.path
				})
			},
			confirm() {
				uni.setStorageSync('empid', this.empid)
				this.show = false
			},
			handleClear(){
				localStorage.clear()
			}
		}
	}
</script>

<style lang="less" scoped>
	.list-group {
		.list-item {
			padding: 15px;
			border-bottom: 1px solid #f2f2f2;
			display: flex;
			align-items: center;
			justify-content: space-between;
		}
	}
</style>